#include "head.h"

//获取文件hash值函数
//参数file_name为文件名
//传入传出参数hash_val，接收返回计算好的hash值
int getHash(const char* file_name,char *hash_val){

    char command[1024];
    sprintf(command,"%s %s","sha1sum",file_name);
    FILE *pipe = popen(command,"r");                
    fread(hash_val,1,1024,pipe);
    strtok(hash_val," ");
    pclose(pipe);

    return 0;
}
